/*
 * 作者: 侯晓宇
 * 时间: 2017-03-12 
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */
define(function(require) {

	require("jquery");

	var c = require('app/utils/CommonUtils');
	var appInfo = require('app/AppInfo');
	var RoomInfoUtils = require('app/utils/RoomInfoUtils');
	var EventUtils = require('app/utils/EventUtils');
	var APIUtils = require('app/utils/APIUtils');
	
	var param = api.pageParam;
	var win = window;
	win.header_h = param.header_h;
	win.footer_h = 50;
	var catalogs = RoomInfoUtils.initRoomCatalog(true);
	catalogs.forEach(function(item){
		var uuid = item.val;
		var name = item.text;
		var div = $('<div class="catalog-item" data-uuid="'+uuid+'">'+
					name+
				'</div>');
		$(".catalog-content").append(div);
	});
	$(".catalog-item").click(function(){
		var uuid = $(this).data("uuid");
		
		api.openWin({
	        name: 'IndexCatalogWin',
	        url: './IndexCatalogWin.html',
	        rect: {
	        	x: 0,
	        	y: 0,
	        	w: APIUtils.winW(),
	        	h: APIUtils.winH()
	        },
	        pageParam:{
	        	cataloguuid: uuid,
	        	showBanner: false
	        }
        });
		api.closeFrame({
        });
        EventUtils.send('root', 'homepageSidebar_status',false);
	});
	
	$(".catalog-header").click(function(){
	
		api.closeFrame({
        });
        EventUtils.send('root', 'homepageSidebar_status',false);
	});
	
	$("#background").click(function(){
	
		api.closeFrame({
        });
        EventUtils.send('root', 'homepageSidebar_status',false);
	});
	
	EventUtils.send('root', 'homepageSidebar_status',true);
	
	return;
});